home *** CD-ROM | disk | FTP | other *** search
/ Enter 2001 April / EnterCD4.iso / Update / SQL Server SP3 / sql70olapsp3i.exe / MSOLAP / Install / data1.cab / Templ_NavBar / jslinks.js < prev    next >
Encoding:
Text File  |  2000-10-25  |  4.9 KB  |  152 lines

  1. function DoNothing()
  2. {
  3.     // Stub
  4. }
  5.  
  6. //*******************
  7. //TASK/LINK FUNCTIONS
  8. //*******************
  9.  
  10. function LoadLinks( iPageType )
  11. {
  12.     // Define start of table
  13.     var szNewTable = '<table id=\"tableLinks\" align=\"center\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" frame=\"void\" rules=\"none\">';
  14.  
  15.     // Dynamically load table rows and table cells
  16.     for( var i = 0; i <= giTotalLinks; i++ ) {
  17.         // Add new table row if i mod 3 = 0
  18.         if( i % 3 == 0 ) {
  19.             szNewTable += '<tr>\n';
  20.             szNewTable += '<td id=\"tdLinks_' + i + '\" width=\"30%\" valign=\"top\" class=\"tdLinks\"></td>\n';
  21.         szNewTable += '<td width=\"5%\"></td>\n';
  22.         szNewTable += '<td id=\"tdLinks_' + ( i + 1 ) + '\" width=\"30%\" valign=\"top\" class=\"tdLinks\"></td>\n';
  23.         szNewTable += '<td width=\"5%\"></td>\n';
  24.             szNewTable += '<td id=\"tdLinks_' + ( i + 2 ) + '\" width=\"30%\" valign=\"top\" class=\"tdLinks\"></td>\n';
  25.             szNewTable += '</tr>\n';
  26.         }        
  27.     }
  28.     
  29.     // Define end of table
  30.     szNewTable += '</table>\n';
  31.     
  32.     // Add new table to div container
  33.     divLinks.insertAdjacentHTML('BeforeEnd', szNewTable );
  34.     
  35.     for( var i = 0; i <= giTotalLinks; i++ ) {
  36.         // Add anchor link to table cells
  37.         switch( iPageType ) {
  38.             case CON_HOMEPAGE:                
  39.                 // Home page handles HREF click navigation locally
  40.                 var szAnchor = '<a href=\"\" id=\"anchorLink_' + i + '\" class=\"anchorLink\">';    
  41.                 break;
  42.             case CON_LINKPAGE:
  43.                 // Link pages (Tasks & More Tasks) defer click navigation to anchor tags
  44.                 var szAnchor = '<a href=\"' + gaszLinkURL[i] +'\" id=\"anchorLink_' + i + '\" class=\"anchorLink\">';        
  45.                 break;
  46.         }        
  47.  
  48.         document.all('tdLinks_' + i).insertAdjacentHTML ( 'BeforeEnd', szAnchor );
  49.         
  50.         // Add caption to anchor
  51.         var szAnchorCaption = gaszLinkTitleText[i];
  52.         document.all('anchorLink_' + i).insertAdjacentHTML ( 'BeforeEnd', szAnchorCaption );
  53.     }
  54. }
  55.  
  56. //******************
  57. // TOOLTIP FUNCTIONS
  58. //******************
  59.  
  60. function LinksTooltipShow()
  61. {
  62.     // Load in appropriate tooltip text from the module-level string array
  63.     tdTooltip.innerHTML = gaszBtnTooltips[giTooltipIndex];
  64.  
  65.     //***************************
  66.     // Calc Y (vertical) location
  67.     //***************************
  68.  
  69.     // Get offsetTop of parent div element
  70.     iYLoc = divLinks.offsetTop;
  71.  
  72.     // Get offsetTop from parent element
  73.     iYLoc += document.all('tdLinks_' + giTooltipIndex).parentElement.offsetTop;
  74.             
  75.     // Get height of element
  76.     iYLoc += document.all('anchorLink_' + giTooltipIndex).offsetHeight;
  77.  
  78.     // Add a % offset
  79.     iYLoc += Math.floor( document.body.clientHeight * L_ConstLinkTooltipOffsetTop_Number );
  80.  
  81.     // Subtract parent div scrollTop to account for container div scrolling (if any)
  82.     iYLoc -= divLinks.scrollTop;
  83.  
  84.     // Position the tooltip vertically
  85.     divTooltip.style.pixelTop = iYLoc;    
  86.     
  87.     iYLoc -= (GetPixelSize(divTooltipPointer.style.fontSize) / L_ConstLinkTooltipPointerOffsetTop_Number);
  88.  
  89.     // Position the tooltip pointer vertically
  90.     divTooltipPointer.style.pixelTop = iYLoc;
  91.  
  92.     //*****************************
  93.     // Calc X (horizontal) location
  94.     //*****************************
  95.  
  96.     // Get offsetWidth of anchor element
  97.     var iAnchorWidth = document.all('anchorLink_' + giTooltipIndex).offsetWidth;
  98.  
  99.     // Get offsetLeft of parent element
  100.     var iTDOffset = document.all('anchorLink_' + giTooltipIndex).parentElement.offsetLeft;
  101.  
  102.     // Get width of tooltip
  103.     var iTooltipWidth = document.all('divTooltip').offsetWidth;
  104.  
  105.     // Center the tooltip horizontally w/ respect to its anchor
  106.     var iXLoc = iTDOffset + ( Math.floor( iAnchorWidth / 2 ) ) - ( Math.floor( iTooltipWidth / 2 ) );
  107.  
  108.     // Get offsetLeft of parent div element
  109.     iXLoc += divLinks.offsetLeft;
  110.  
  111.     // Position the tooltip horizontally
  112.     divTooltip.style.left = iXLoc;
  113.     
  114.     iXLoc += (iTooltipWidth / 2) - ( GetPixelSize(divTooltipPointer.style.fontSize) / 2 );
  115.  
  116.     // Position the tooltip pointer horizontally
  117.     divTooltipPointer.style.pixelLeft = iXLoc;
  118.  
  119.     // Show the tooltip & pointer
  120.     divTooltip.style.visibility = 'visible';
  121.     divTooltipPointer.style.visibility = 'visible';    
  122. }
  123.  
  124. function LinksTooltipHide()
  125. {
  126.     divTooltip.style.visibility = 'hidden';
  127.     divTooltipPointer.style.visibility = 'hidden';
  128.     window.clearTimeout(gTooltipTimer);
  129.     //Empty the innerHTML, which causes the height to collapse
  130.     tdTooltip.innerHTML = '';
  131. }
  132.  
  133. //****************
  134. //RESIZE FUNCTIONS
  135. //****************
  136.  
  137. function ResizeFonts()
  138. {
  139.     var iSmallerDimension = GetSmallerDimension();
  140.     
  141.     //Apply custom multipliers
  142.     divLinksCaption.style.fontSize = iSmallerDimension * L_ConstCaptionText_Number;
  143.     
  144.     //Anchor links
  145.     for( var i = 0; i <= giTotalLinks; i++ ) {
  146.         document.all('anchorLink_' + i ).style.fontSize = iSmallerDimension * L_ConstAnchorLinkText_Number;
  147.     }    
  148.     
  149.     // Tooltips
  150.     tblTooltip.style.fontSize = iSmallerDimension * L_ConstTooltipText_Number;
  151.     divTooltipPointer.style.fontSize = iSmallerDimension * L_ConstTooltipPointerText_Number;
  152. }